
 <!DOCTYPE HTML>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  
    <title>Vue2使用笔记6--vue与各种插件和谐相处地创建表单 | Here. There.</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=3, minimum-scale=1">
    
    <meta name="author" content="被删">
    
    <meta name="description" content="最近在使用Vue2作为项目中前端的框架，《Vue2使用笔记》系列用于记录过程中的一些使用和解决方法。本文记录vue中使用各种插件和库，以及创建简单表单的使用过程。">
    
    
    
    
    <link rel="alternate" href="/atom.xml" title="Here. There." type="application/atom+xml">
    
    
    <link rel="icon" href="/img/favicon.ico">
    
    
    <link rel="apple-touch-icon" href="/img/pacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/pacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css">
    
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?3d902de4a19cf2bf179534ffd2dd7b7f";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</head>

  <body>
    <header>
      <div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/sun.png" alt="Here. There." title="Here. There."/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title="Here. There.">Here. There.</a></h1>
				<h2 class="blog-motto">Love ice cream. Love sunshine. Love life. Love the world. Love myself. Love you.</h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="菜单">
			</a></div>
			<nav class="animated">
				<ul>
					
						<li><a href="/">首页</a></li>
					
						<li><a href="https://github.com/godbasin/godbasin.github.io">所有文章</a></li>
					
						<li><a href="/archives">归档</a></li>
					
						<li><a href="/categories">分类</a></li>
					
						<li><a href="https://godbasin.github.io/front-end-playground">前端游乐场</a></li>
					
						<li><a href="/about">关于我</a></li>
					
				</ul>
			</nav>			
</div>

    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/2016/12/04/vue2-notes-6-form-with-some-plugins/" title="Vue2使用笔记6--vue与各种插件和谐相处地创建表单" itemprop="url">Vue2使用笔记6--vue与各种插件和谐相处地创建表单</a>
  </h1>
  <p class="article-author">By
    
      <a href="https://godbasin.github.io" title="被删">被删</a>
    </p>
  <p class="article-time">
    <time datetime="2016-12-04T00:05:39.000Z" itemprop="datePublished">2016-12-04</time>
    更新日期:<time datetime="2018-12-18T15:41:36.675Z" itemprop="dateModified">2018-12-18</time>
    
  </p>
</header>
	<div class="article-content">
		
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">文章目录</strong>
		<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#一些插件"><span class="toc-number">1.</span> <span class="toc-text">一些插件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#iCheck"><span class="toc-number">1.1.</span> <span class="toc-text">iCheck</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#switchery"><span class="toc-number">1.2.</span> <span class="toc-text">switchery</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#daterangepicker"><span class="toc-number">1.3.</span> <span class="toc-text">daterangepicker</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#其他插件"><span class="toc-number">1.4.</span> <span class="toc-text">其他插件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#创建表单"><span class="toc-number">2.</span> <span class="toc-text">创建表单</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#ServiceAdd组件"><span class="toc-number">2.1.</span> <span class="toc-text">ServiceAdd组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#页面效果"><span class="toc-number">2.2.</span> <span class="toc-text">页面效果</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#结束语"><span class="toc-number">3.</span> <span class="toc-text">结束语</span></a></li></ol>
		</div>
		
		<p>最近在使用Vue2作为项目中前端的框架，《Vue2使用笔记》系列用于记录过程中的一些使用和解决方法。<br>本文记录vue中使用各种插件和库，以及创建简单表单的使用过程。<br><a id="more"></a></p>
<h2 id="一些插件"><a href="#一些插件" class="headerlink" title="一些插件"></a>一些插件</h2><hr>
<p>在开发中，遇到一些小的项目，拓展和维护都不会太多，这时候我们可以使用一些现成的插件和库进行快速搭建。<br>这里我们使用到以下的一些插件：</p>
<ul>
<li>iCheck</li>
<li>switchery</li>
<li>daterangepicker</li>
</ul>
<p>后面还会用到dataTable，也是很棒的一个插件库，后续章节会有相关的介绍。</p>
<p>这里我们将这些插件的调用放到一个统一的文件common.js中进行管理，封装统一的接口，方便调用。</p>
<h3 id="iCheck"><a href="#iCheck" class="headerlink" title="iCheck"></a>iCheck</h3><p><a href="http://icheck.fronteed.com/" target="_blank" rel="external">iCheck</a>是个基于jQuery的表单选项插件，有多种可以选的皮肤，兼容PC端和移动端。<br>这里我们选用绿色的flat皮肤使用。</p>
<ul>
<li>引入相关文件</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="comment">&lt;!-- index.html --&gt;</span></div><div class="line"><span class="comment">&lt;!-- iCheck style --&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">href</span>=<span class="string">"./static/gentelella/lib/css/iCheck/green.css"</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span>&gt;</span></div><div class="line"><span class="comment">&lt;!-- iCheck script --&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./static/gentelella/lib/js/icheck.min.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div></pre></td></tr></table></figure>
<p>当然，我们调用iCheck可以自定义一些属性，作为规范或者约定来使用。<br>这里本骚年就默认使用name作为组件data的值，而value作为选中值。</p>
<ul>
<li>组件中使用</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">label</span>&gt;</span><span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"radio"</span> <span class="attr">class</span>=<span class="string">"flat"</span> <span class="attr">name</span>=<span class="string">"type"</span> <span class="attr">value</span>=<span class="string">"type1"</span> <span class="attr">v-model</span>=<span class="string">"type"</span>&gt;</span> type1<span class="tag">&lt;/<span class="name">label</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">label</span>&gt;</span><span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"radio"</span> <span class="attr">class</span>=<span class="string">"flat"</span> <span class="attr">name</span>=<span class="string">"type"</span> <span class="attr">value</span>=<span class="string">"type2"</span> <span class="attr">v-model</span>=<span class="string">"type"</span>&gt;</span> type2<span class="tag">&lt;/<span class="name">label</span>&gt;</span></div></pre></td></tr></table></figure>
<ul>
<li>common.js中的公用接口</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// common.js</span></div><div class="line"><span class="keyword">const</span> SetICheck = <span class="function"><span class="params">that</span> =&gt;</span> &#123;</div><div class="line">    <span class="comment">// iCheck</span></div><div class="line">    <span class="keyword">if</span> ($(<span class="string">"input.flat"</span>)[<span class="number">0</span>]) &#123;</div><div class="line">        $(<span class="string">'input.flat'</span>).iCheck(&#123;</div><div class="line">            <span class="attr">checkboxClass</span>: <span class="string">'icheckbox_flat-green'</span>,</div><div class="line">            <span class="attr">radioClass</span>: <span class="string">'iradio_flat-green'</span></div><div class="line">        &#125;);</div><div class="line">        $(<span class="string">'input'</span>).on(<span class="string">'ifChecked'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">event</span>) </span>&#123;</div><div class="line">      <span class="comment">// 传入vue组件对象，对其进行赋值</span></div><div class="line">            that.$set(that, event.currentTarget.name, event.currentTarget.value);</div><div class="line">        &#125;);</div><div class="line">    &#125;</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
<h3 id="switchery"><a href="#switchery" class="headerlink" title="switchery"></a>switchery</h3><p><a href="https://github.com/abpetkov/switchery" target="_blank" rel="external">switchery</a>是个简单的JavaScript组件，可以帮助用户把默认的HTML复选框转换成漂亮iOS7样式风格。<br>具体的api和相关介绍大家可以自行去查文档，这里就不多说啦，直接上码：</p>
<ul>
<li>引入相关文件</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="comment">&lt;!-- Switchery style--&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">href</span>=<span class="string">"./static/gentelella/lib/css/switchery.min.css"</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span>&gt;</span></div><div class="line"></div><div class="line"><span class="comment">&lt;!-- Switchery script--&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./static/gentelella/lib/js/switchery.min.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div></pre></td></tr></table></figure>
<ul>
<li>组件中使用</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="comment">&lt;!-- true为启用值，false为关闭值，name为data值--&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">label</span>&gt;</span><span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"checkbox"</span> <span class="attr">class</span>=<span class="string">"js-switch"</span> <span class="attr">name</span>=<span class="string">"state"</span> <span class="attr">true</span>=<span class="string">"1"</span> <span class="attr">false</span>=<span class="string">"0"</span> <span class="attr">checked</span> /&gt;</span> &#123;&#123;state === 1 ? '激活' : '未激活'&#125;&#125;<span class="tag">&lt;/<span class="name">label</span>&gt;</span></div></pre></td></tr></table></figure>
<ul>
<li>common.js</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">const</span> SetSwitchery = <span class="function"><span class="params">that</span> =&gt;</span> &#123;</div><div class="line">    <span class="comment">// Switchery</span></div><div class="line">    <span class="keyword">if</span> ($(<span class="string">".js-switch"</span>)[<span class="number">0</span>]) &#123;</div><div class="line">        <span class="keyword">var</span> elems = <span class="built_in">Array</span>.prototype.slice.call(<span class="built_in">document</span>.querySelectorAll(<span class="string">'.js-switch'</span>));</div><div class="line">        elems.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">html</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> switchery = <span class="keyword">new</span> Switchery(html, &#123;</div><div class="line">                <span class="attr">color</span>: <span class="string">'#26B99A'</span></div><div class="line">            &#125;);</div><div class="line">            html.onchange = <span class="function"><span class="params">()</span> =&gt;</span> &#123;</div><div class="line">                <span class="keyword">var</span> value = html.checked === <span class="literal">true</span> ? <span class="built_in">Number</span>(html.attributes[<span class="string">'true'</span>].value) : <span class="built_in">Number</span>(html.attributes[<span class="string">'false'</span>].value);</div><div class="line">                that.$set(that, html.name, value);</div><div class="line">            &#125;;</div><div class="line">        &#125;);</div><div class="line"></div><div class="line">    &#125;</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
<h3 id="daterangepicker"><a href="#daterangepicker" class="headerlink" title="daterangepicker"></a>daterangepicker</h3><p><a href="http://www.daterangepicker.com/" target="_blank" rel="external">daterangepicker</a>是个基于bootstrap的日历插件，有单日历和双日历，很方便使用，样式也是棒棒哒。<br>不废话，上码：</p>
<ul>
<li>引入相关文件</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">&lt;!-- bootstrap-daterangepicker --&gt;</span></div><div class="line"><span class="comment">&lt;!-- 样式直接使用bootstrap --&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./static/gentelella/lib/js/moment.min.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./static/gentelella/lib/js/daterangepicker.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div></pre></td></tr></table></figure>
<ul>
<li>组件中使用</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"xdisplay_inputx form-group has-feedback"</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">class</span>=<span class="string">"form-control has-feedback-left"</span> <span class="attr">id</span>=<span class="string">"single_cal3"</span> <span class="attr">v-model</span>=<span class="string">"expiresDate"</span> <span class="attr">placeholder</span>=<span class="string">"点击选择日期"</span> <span class="attr">aria-describedby</span>=<span class="string">"inputSuccess2Status3"</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">span</span> <span class="attr">class</span>=<span class="string">"fa fa-calendar-o form-control-feedback left"</span> <span class="attr">aria-hidden</span>=<span class="string">"true"</span>&gt;</span><span class="tag">&lt;/<span class="name">span</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">span</span> <span class="attr">id</span>=<span class="string">"inputSuccess2Status3"</span> <span class="attr">class</span>=<span class="string">"sr-only"</span>&gt;</span>(success)<span class="tag">&lt;/<span class="name">span</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></div></pre></td></tr></table></figure>
<ul>
<li>common.js</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">const</span> SetDaterangepicker = <span class="function">(<span class="params">that, eleToSet</span>) =&gt;</span> &#123;</div><div class="line">    <span class="keyword">var</span> today = <span class="keyword">new</span> <span class="built_in">Date</span>(),</div><div class="line">        todate = &#123;</div><div class="line">            <span class="attr">year</span>: today.getFullYear(),</div><div class="line">            <span class="attr">month</span>: today.getMonth() + <span class="number">1</span>,</div><div class="line">            <span class="attr">date</span>: today.getDate(),</div><div class="line">        &#125;;</div><div class="line">        <span class="comment">// daterangepicker</span></div><div class="line">    $(eleToSet).daterangepicker(&#123;</div><div class="line">        <span class="attr">singleDatePicker</span>: <span class="literal">true</span>,</div><div class="line">        <span class="attr">format</span>: <span class="string">'YYYY-MM-DD'</span>,</div><div class="line">        <span class="attr">minDate</span>: <span class="string">`<span class="subst">$&#123;todate.year&#125;</span>-<span class="subst">$&#123;todate.month&#125;</span>-<span class="subst">$&#123;todate.date&#125;</span>`</span>,</div><div class="line">        <span class="attr">calender_style</span>: <span class="string">"picker_3"</span></div><div class="line">    &#125;, <span class="function"><span class="keyword">function</span>(<span class="params">start, end, label</span>) </span>&#123;</div><div class="line">        that.expiresDate = start.toISOString().substring(<span class="number">0</span>, <span class="number">10</span>);</div><div class="line">    &#125;);</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h3 id="其他插件"><a href="#其他插件" class="headerlink" title="其他插件"></a>其他插件</h3><p>Gentelella模板中还使用了一些其他的插件，像<a href="http://select2.github.io/" target="_blank" rel="external">select2</a>等等，具体的本骚年就不在这里讲了，大家可以自行发挥想象力和创造力去把这些东西融合进来，尽情使用。</p>
<h2 id="创建表单"><a href="#创建表单" class="headerlink" title="创建表单"></a>创建表单</h2><hr>
<p>这里我们在创建服务模块弄个简单的表单呗~</p>
<h3 id="ServiceAdd组件"><a href="#ServiceAdd组件" class="headerlink" title="ServiceAdd组件"></a>ServiceAdd组件</h3><p>直接上代码？（捂脸）<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div><div class="line">152</div><div class="line">153</div><div class="line">154</div><div class="line">155</div><div class="line">156</div><div class="line">157</div><div class="line">158</div><div class="line">159</div><div class="line">160</div><div class="line">161</div><div class="line">162</div><div class="line">163</div><div class="line">164</div><div class="line">165</div><div class="line">166</div><div class="line">167</div><div class="line">168</div><div class="line">169</div><div class="line">170</div><div class="line">171</div><div class="line">172</div><div class="line">173</div><div class="line">174</div><div class="line">175</div></pre></td><td class="code"><pre><div class="line">&lt;template&gt;</div><div class="line">  &lt;div class=&quot;&quot;&gt;</div><div class="line">    &lt;div class=&quot;page-title&quot;&gt;</div><div class="line">      &lt;div class=&quot;title_left&quot;&gt;</div><div class="line">        &lt;h3&gt;服务管理 &lt;small&gt;&gt; 新建&lt;/small&gt;&lt;/h3&gt;</div><div class="line">      &lt;/div&gt;</div><div class="line">    &lt;/div&gt;</div><div class="line"></div><div class="line">    &lt;div class=&quot;clearfix&quot;&gt;&lt;/div&gt;</div><div class="line">    &lt;!-- normal form --&gt;</div><div class="line">    &lt;div class=&quot;x_panel&quot;&gt;</div><div class="line">      &lt;div class=&quot;x_title&quot;&gt;</div><div class="line">        &lt;h2&gt;新建服务&lt;/h2&gt;</div><div class="line">        &lt;div class=&quot;clearfix&quot;&gt;&lt;/div&gt;</div><div class="line">      &lt;/div&gt;</div><div class="line">      &lt;div class=&quot;x_content&quot;&gt;</div><div class="line">        &lt;br /&gt;</div><div class="line">        &lt;form class=&quot;form-horizontal form-label-left&quot;&gt;</div><div class="line"></div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;名称&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12&quot;&gt;</div><div class="line">              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;&quot; v-model=&quot;name&quot; required&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;编码&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12&quot;&gt;</div><div class="line">              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; v-model=&quot;code&quot; placeholder=&quot;编码/别名，方便查询使用&quot;&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">                    &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;类型&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12 table-radio&quot;&gt;</div><div class="line">              &lt;label&gt;&lt;input type=&quot;radio&quot; class=&quot;flat&quot; name=&quot;type&quot; value=&quot;type1&quot; v-model=&quot;type&quot;&gt; type1&lt;/label&gt;</div><div class="line">              &lt;label&gt;&lt;input type=&quot;radio&quot; class=&quot;flat&quot; name=&quot;type&quot; value=&quot;type2&quot; v-model=&quot;type&quot;&gt; type2&lt;/label&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;状态&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12 table-radio&quot;&gt;</div><div class="line">              &lt;div class=&quot;&quot;&gt;</div><div class="line">                &lt;label&gt;&lt;input type=&quot;checkbox&quot; class=&quot;js-switch&quot; name=&quot;state&quot; true=&quot;1&quot; false=&quot;0&quot; checked /&gt; &#123;&#123;state === 1 ? &apos;激活&apos; : &apos;未激活&apos;&#125;&#125;&lt;/label&gt;</div><div class="line">              &lt;/div&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;过期日期&lt;/label&gt;</div><div class="line">            &lt;fieldset class=&quot;col-md-6 col-sm-8 col-xs-12&quot;&gt;</div><div class="line">              &lt;div class=&quot;xdisplay_inputx form-group has-feedback&quot;&gt;</div><div class="line">                &lt;input type=&quot;text&quot; class=&quot;form-control has-feedback-left&quot; id=&quot;single_cal3&quot; v-model=&quot;expiresDate&quot; placeholder=&quot;点击选择日期&quot; aria-describedby=&quot;inputSuccess2Status3&quot;&gt;</div><div class="line">                &lt;span class=&quot;fa fa-calendar-o form-control-feedback left&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;</div><div class="line">                &lt;span id=&quot;inputSuccess2Status3&quot; class=&quot;sr-only&quot;&gt;(success)&lt;/span&gt;</div><div class="line">              &lt;/div&gt;</div><div class="line">            &lt;/fieldset&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;是否接受通知&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12 table-radio&quot;&gt;</div><div class="line">              &lt;label&gt;&lt;input type=&quot;checkbox&quot; class=&quot;js-switch&quot; name=&quot;directIssue&quot; true=&quot;1&quot; false=&quot;0&quot; checked /&gt; &#123;&#123;directIssue === 1 ? &apos;是&apos; : &apos;否&apos;&#125;&#125;&lt;/label&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line">          &lt;transition name=&quot;slide-form&quot;&gt;</div><div class="line">            &lt;div class=&quot;form-group slide-form&quot; v-show=&quot;directIssue === 1&quot;&gt;</div><div class="line">              &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;通知邮件&lt;/label&gt;</div><div class="line">              &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12&quot;&gt;</div><div class="line">                &lt;input type=&quot;email&quot; class=&quot;form-control&quot; name=&quot;email&quot; v-model=&quot;email&quot;&gt;</div><div class="line">              &lt;/div&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/transition&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">            &lt;label class=&quot;control-label col-md-3 col-sm-3 col-xs-12&quot;&gt;备注&lt;/label&gt;</div><div class="line">            &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12&quot;&gt;</div><div class="line">              &lt;textarea class=&quot;form-control&quot; name=&quot;remark&quot; v-model=&quot;remark&quot;&gt;&lt;/textarea&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line"></div><div class="line"></div><div class="line">          &lt;div class=&quot;ln_solid&quot;&gt;&lt;/div&gt;</div><div class="line">          &lt;div class=&quot;form-group&quot;&gt;</div><div class="line">                        &lt;!--错误信息显示--&gt;</div><div class="line">                        &lt;div class=&quot;col-md-6 col-sm-8 col-xs-12 col-md-offset-3&quot;&gt;</div><div class="line">                            &lt;div class=&quot;alert alert-danger alert-dismissible fade in&quot; role=&quot;alert&quot; v-show=&quot;error.shown&quot;&gt;</div><div class="line">                &lt;strong&gt;错误：&lt;/strong&gt; &#123;&#123;error.text&#125;&#125;</div><div class="line">              &lt;/div&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">            &lt;div class=&quot;col-md-9 col-sm-9 col-xs-12 col-md-offset-3&quot;&gt;</div><div class="line">              &lt;a class=&quot;btn btn-success&quot; v-on:click=&quot;submit&quot;&gt;提交&lt;/a&gt;</div><div class="line">              &lt;router-link to=&quot;/app/terminals&quot; class=&quot;btn btn-default&quot;&gt;取消&lt;/router-link&gt;</div><div class="line">            &lt;/div&gt;</div><div class="line">          &lt;/div&gt;</div><div class="line"></div><div class="line">        &lt;/form&gt;</div><div class="line">      &lt;/div&gt;</div><div class="line">    &lt;/div&gt;</div><div class="line">  &lt;/div&gt;</div><div class="line">  &lt;!-- /normal form --&gt;</div><div class="line">&lt;/template&gt;</div><div class="line"></div><div class="line"></div><div class="line">&lt;script&gt;</div><div class="line">    var initData = () =&gt; &#123;</div><div class="line">        return &#123;</div><div class="line">            isNew: true,</div><div class="line">            name: &apos;&apos;,</div><div class="line">            code: &apos;&apos;,</div><div class="line">            expiresDate: &apos;&apos;,</div><div class="line">            email: &apos;&apos;,</div><div class="line">            type: &apos;type1&apos;,</div><div class="line">            directIssue: 1,</div><div class="line">            state: 1,</div><div class="line">            terminalId: &apos;&apos;,</div><div class="line">            appKey: &apos;&apos;,</div><div class="line">            appSecret: &apos;&apos;,</div><div class="line">            activeDate: &apos;&apos;,</div><div class="line">            expiresDate: &apos;&apos;,</div><div class="line">            remark: &apos;&apos;,</div><div class="line">            error: &#123;</div><div class="line">                text: &apos;&apos;,</div><div class="line">                shown: false</div><div class="line">            &#125;</div><div class="line">        &#125;;</div><div class="line">    &#125;;</div><div class="line">    export default &#123;</div><div class="line">        name: &apos;SeviceAdd&apos;,</div><div class="line">        data() &#123;</div><div class="line">            return initData();</div><div class="line">        &#125;,</div><div class="line">        methods: &#123;</div><div class="line">            setChange(item) &#123;</div><div class="line">                var that = this;</div><div class="line">                // 设置插件默认值</div><div class="line">                if (item.state !== that.state) &#123;</div><div class="line">                    $(&apos;.js-switch[name=&quot;state&quot;]&apos;).trigger(&apos;click&apos;);</div><div class="line">                &#125;</div><div class="line">                if (item.directIssue !== that.directIssue) &#123;</div><div class="line">                    $(&apos;.js-switch[name=&quot;directIssue&quot;]&apos;).trigger(&apos;click&apos;);</div><div class="line">                &#125;</div><div class="line">            &#125;,</div><div class="line">            submit() &#123;</div><div class="line">                var that = this,</div><div class="line">                    text;</div><div class="line">                // 先做一些简单的校验，不通过则显示错误信息</div><div class="line">                if (!that.name) &#123;</div><div class="line">                    text = &apos;请填写名称&apos;;</div><div class="line">                &#125;</div><div class="line">                if (text) &#123;</div><div class="line">                    that.error.text = text;</div><div class="line">                    that.error.shown = true;</div><div class="line">                    return;</div><div class="line">                &#125;</div><div class="line">                that.error.shown = false;</div><div class="line">                var that = this;</div><div class="line"></div><div class="line">                that.$router.push(&apos;/app/terminals&apos;);</div><div class="line">            &#125;</div><div class="line">        &#125;,</div><div class="line">        mounted() &#123;</div><div class="line">            var that = this;</div><div class="line">            var data = initData();</div><div class="line">            // 设置初始值</div><div class="line">            $.each(data, (key, item) =&gt; &#123;</div><div class="line">                that.$set(that, key, item);</div><div class="line">            &#125;);</div><div class="line">            // 初始化iCheck</div><div class="line">            SetICheck(that);</div><div class="line">            // 初始化Switchery</div><div class="line">            SetSwitchery(that);</div><div class="line">            // 初始化Daterangepicker</div><div class="line">            SetDaterangepicker(that, &apos;#single_cal3&apos;);</div><div class="line">            // 设置插件默认值</div><div class="line">            that.setChange(data);</div><div class="line">        &#125;</div><div class="line">    &#125;</div><div class="line">&lt;/script&gt;</div></pre></td></tr></table></figure></p>
<h3 id="页面效果"><a href="#页面效果" class="headerlink" title="页面效果"></a>页面效果</h3><p><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/EB7E.tmp.png" alt="image"></p>
<h2 id="结束语"><a href="#结束语" class="headerlink" title="结束语"></a>结束语</h2><hr>
<p>这里只是用到最简单的css过渡，但是vue的过渡效果以及过渡状态还是很牛逼的，大家有兴趣的可以去看看<a href="https://vuefe.cn/guide/transitions.html" target="_blank" rel="external">官方文档</a>然后多尝试一下呢，酷酷的。<br><a href="https://github.com/godbasin/godbasin.github.io/tree/blog-codes/vue2-notes/6-form-with-some-plugins" target="_blank" rel="external">此处查看项目代码</a><br><a href="http://vue2-notes.godbasin.com/6-form-with-some-plugins/index.html#/app/add/service" target="_blank" rel="external">此处查看页面效果</a></p>
  
		
		<p style="margin-top:50px;">
			查看Github有更多内容噢：<a href="https://github.com/godbasin">https://github.com/godbasin</a>
			<br>
			更欢迎来<a href="https://godbasin.github.io/front-end-playground">被删的前端游乐场</a>边撸猫边学前端噢
		</p>
	</div>
	<img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/2code2.jpg" width="200" height="200" style="display:block;margin: 0 auto;" />
	<p style="text-align: center;margin-top: 10px;margin-bottom: 20px;">码生艰难，写文不易，给我家猪囤点猫粮了喵~</p>
	<div class="author-right">
  		<p>作者：被删</p>
  		<p>出处：<a href="https://godbasin.github.io">https://godbasin.github.io</a></p>
  		<p>本文版权归作者所有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</p>
	</div>
		<footer class="article-footer clearfix">

  <div class="article-tags">
  
  <span></span> <a href="/tags/笔记/">笔记</a>
  </div>


<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/vue八宝粥/">vue八宝粥</a>
</div>



<div class="article-share" id="share">

  
<!-- JiaThis Button BEGIN -->
<div class="jiathis_style_24x24">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_weixin"></a>
	<a class="jiathis_button_renren"></a>
	<a href="http://www.jiathis.com/share?uid=2134021" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
</div>
<script type="text/javascript">
var jiathis_config = {data_track_clickback:'true'};
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js?uid=2134021" charset="utf-8"></script>
<!-- JiaThis Button END -->   


</div>
</footer>   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/2016/12/10/vue2-notes-7-use-datatable-with-html/" title="Vue2使用笔记7--vue与datatables(一):浏览器渲染">
  <strong>PREVIOUS:</strong><br/>
  <span>
  Vue2使用笔记7--vue与datatables(一):浏览器渲染</span>
</a>
</div>


<div class="next">
<a href="/2016/12/03/vue2-notes-5-transition-animation/"  title="Vue2使用笔记5--transition过渡效果使用">
 <strong>NEXT:</strong><br/> 
 <span>Vue2使用笔记5--transition过渡效果使用
</span>
</a>
</div>

</nav>

	<!-- 如果不是首页且没使用 `comments: false` 关闭评论，则尝试加载评论 -->

    <!-- 配置中启用多说时，导入相应代码 -->
    


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="显示侧边栏"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">文章目录</strong>
  <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#一些插件"><span class="toc-number">1.</span> <span class="toc-text">一些插件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#iCheck"><span class="toc-number">1.1.</span> <span class="toc-text">iCheck</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#switchery"><span class="toc-number">1.2.</span> <span class="toc-text">switchery</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#daterangepicker"><span class="toc-number">1.3.</span> <span class="toc-text">daterangepicker</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#其他插件"><span class="toc-number">1.4.</span> <span class="toc-text">其他插件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#创建表单"><span class="toc-number">2.</span> <span class="toc-text">创建表单</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#ServiceAdd组件"><span class="toc-number">2.1.</span> <span class="toc-text">ServiceAdd组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#页面效果"><span class="toc-number">2.2.</span> <span class="toc-text">页面效果</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#结束语"><span class="toc-number">3.</span> <span class="toc-text">结束语</span></a></li></ol>
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="隐藏侧边栏"></a></div>
<aside class="clearfix">

  	
	<div class="archiveslist">
		<p class="asidetitle">最近文章</p>
			<ul class="archive-list">
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/15/wxapp-latest-20191115/" title="小程序开发月刊第11期（20191115）">小程序开发月刊第11期（201911...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/10/change-log/" title="前端 CHANGELOG 生成指南">前端 CHANGELOG 生成指南...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/09/wxapp-global-data-behavior/" title="小程序的奇技淫巧 -- globalDataBehavior管理全局状态">小程序的奇技淫巧 -- global...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/10/15/wxapp-latest-20191015/" title="小程序开发月刊第十期（20191015）">小程序开发月刊第十期（2019101...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/10/13/about-front-end-3-growth/" title="前端这几年--3.关于成长和焦虑">前端这几年--3.关于成长和焦虑...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/09/16/wxapp-latest-20190916/" title="小程序开发月刊第九期（20190916）">小程序开发月刊第九期（2019091...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/08/15/wxapp-latest-20190815/" title="小程序开发月刊第八期（20190815）">小程序开发月刊第八期（2019081...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/27/front-end-playground/" title="被删的前端游乐场建成！">被删的前端游乐场建成！</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/21/vue-for-everyone-3/" title="9102全员学Vue--3.把页面拼成个Web应用">9102全员学Vue--3.把页面拼...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/15/wxapp-latest-20190715/" title="小程序开发月刊第七期（20190715）">小程序开发月刊第七期（2019071...</a>
				</li>
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
			</ul>
	</div>


  
  <div class="archiveslist">
    <p class="asidetitle"><a href="/archives">归档</a></p>
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">十一月 2019</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">十月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">九月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">八月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">七月 2019</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">六月 2019</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">五月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">四月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">三月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/02/">二月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/01/">一月 2019</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">十二月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">十一月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/10/">十月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/09/">九月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">八月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">七月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">六月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/05/">五月 2018</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">四月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">三月 2018</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">二月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">一月 2018</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/">十二月 2017</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/11/">十一月 2017</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/">十月 2017</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/09/">九月 2017</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">八月 2017</a><span class="archive-list-count">11</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">七月 2017</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">六月 2017</a><span class="archive-list-count">10</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">五月 2017</a><span class="archive-list-count">15</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">四月 2017</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">三月 2017</a><span class="archive-list-count">10</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/02/">二月 2017</a><span class="archive-list-count">41</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/">一月 2017</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/">十二月 2016</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/">十一月 2016</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/">十月 2016</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/09/">九月 2016</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">七月 2016</a><span class="archive-list-count">14</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a><span class="archive-list-count">9</span></li></ul>
  </div>


  
<div class="archiveslist">
	<p class="asidetitle"><a href="/categories">分类</a></p>
		<ul class="archive-list">
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/CSS炒饭/" title="CSS炒饭">CSS炒饭<sup>3</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/D3小馒头/" title="D3小馒头">D3小馒头<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/angular2火锅/" title="angular2火锅">angular2火锅<sup>25</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/angular混搭/" title="angular混搭">angular混搭<sup>33</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/box2djs方糖/" title="box2djs方糖">box2djs方糖<sup>34</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/cyclejs哈根达斯/" title="cyclejs哈根达斯">cyclejs哈根达斯<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/jQuery杂烩/" title="jQuery杂烩">jQuery杂烩<sup>3</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/js什锦/" title="js什锦">js什锦<sup>26</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/react沙拉/" title="react沙拉">react沙拉<sup>16</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/three-js奶茶/" title="three.js奶茶">three.js奶茶<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/vue八宝粥/" title="vue八宝粥">vue八宝粥<sup>29</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/webpack宾治/" title="webpack宾治">webpack宾治<sup>9</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/web乱炖/" title="web乱炖">web乱炖<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/前端满汉全席/" title="前端满汉全席">前端满汉全席<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/喵/" title="喵">喵<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/小程序双皮奶/" title="小程序双皮奶">小程序双皮奶<sup>27</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/工作这杯茶/" title="工作这杯茶">工作这杯茶<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/应用巧克力盒/" title="应用巧克力盒">应用巧克力盒<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/思想棉花糖/" title="思想棉花糖">思想棉花糖<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/柴米油盐工具集/" title="柴米油盐工具集">柴米油盐工具集<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/自动化甜筒/" title="自动化甜筒">自动化甜筒<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/非前端钙片/" title="非前端钙片">非前端钙片<sup>7</sup></a>
			</li>
		
		</ul>
</div>


  
<div class="archiveslist">
	<p class="asidetitle">标签</p>
		<ul class="archive-list">
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/分享/" title="分享">分享<sup>44</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/原创部件/" title="原创部件">原创部件<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/心态/" title="心态">心态<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/教程/" title="教程">教程<sup>73</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/晒猫/" title="晒猫">晒猫<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/笔记/" title="笔记">笔记<sup>121</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/算法/" title="算法">算法<sup>9</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/自制插件/" title="自制插件">自制插件<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/逻辑实现/" title="逻辑实现">逻辑实现<sup>5</sup></a>
			</li>
		
		</ul>
</div>


    <div class="archiveslist">
    <p class="asidetitle"><a href="/archives">about</a></p>
      <ul class="archive-list">
      	<li class="archive-list-item">
      		<a>wangbeishan@163.com</a>
      		<a href="https://github.com/godbasin">github.com/godbasin</a>
      	</li>
      </ul>
  </div>

  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS 订阅</a>
</div>

</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<section class="info">
		<p> 即使梦想再小，却很伟大 ^_^ </p>
	</section>
	 
		<p class="copyright">Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/A-limon/pacman" target="_blank" title="Pacman">Pacman</a> © 2019 
		
		<a href="https://godbasin.github.io" target="_blank" title="被删">被删</a>
		
		</p>
</div>
</footer>
    <script src="/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else
    {
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      h  = $('article h2')
      ah = $('article h2'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  if(ah.length==0){
    t.css('display','none');
  }else{
    c.click(function(){
      ta.css('display', 'block').addClass('fadeIn');
    });
    o.click(function(){
      ta.css('display', 'none');
    });
    $(window).scroll(function(){
      ta.css("top",Math.max(140,320-$(this).scrollTop()));
    });
  };
});
</script>







  </body>
</html>
